from database.database import db

class MessageNotifications(db.Model):
    __tablename__ = 'message_notifications'
    
    id = db.Column(db.Integer, primary_key=True)
    sender_id = db.Column(db.String(255), nullable=False)
    receiver_id = db.Column(db.String(255), nullable=False)
    content = db.Column(db.Text, nullable=False)
    is_read = db.Column(db.Integer, nullable=False)
    send_time = db.Column(db.TIMESTAMP, nullable=False)
    is_deleted = db.Column(db.Integer, nullable=False)
    
    def __init__(self, sender_id, receiver_id, content, is_read, send_time, is_deleted):
        self.sender_id = sender_id
        self.receiver_id = receiver_id
        self.content = content
        self.is_read = is_read
        self.send_time = send_time
        self.is_deleted = is_deleted
    
    def to_dict(self):
        return {
            'id': self.id,
            'sender_id': self.sender_id,
            'receiver_id': self.receiver_id,
            'content': self.content,
            'is_read': self.is_read,
            'send_time': self.send_time,
            'is_deleted': self.is_deleted
        }